﻿using System;
using System.Globalization;
using System.IO;
using Avalonia.Data.Converters;

namespace MarkdownRow.Converters;

public class PathConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is string s) return Path.GetFileName(s);
        return value;
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        return value;
    }
}